import { Component, lazy } from 'react';
// import { createBroswerRouter } from 'react-router-dom';
import { createBrowserRouter } from 'react-router-dom';

import App from '../App';
import Home from '../pages/Home/Home';
import Chat from '../pages/Chat/Chat';
import Login from '../pages/Login/Login';
import Detail from '../pages/Detail/Detail';

// const App = lazy(() => import('../App'))
// const Home = lazy(() => import('@/pages/Home/Home.jsx'))
// const Chat = lazy(() => import('@/pages/Chat/Chat.jsx'))
// const Login = lazy(() => import('@/pages/Login/Login.jsx'))

const router = createBrowserRouter([
    {
        path: '/',
        element: <App />,
        // Component: App
        children: [
            {
                path: '/',
                index: true, //二级路由默认显示
                element: <Home />
            },
            {
                path: 'chat',
                element: <Chat />
            },

        ]
    },
    {
        path: '/login',
        element: <Login />
    },
    {
        path: '/detail',
        element: <Detail />
    }
])

export default router